package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-03-08
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_iot_charging_line_trans_order")
@ApiModel(value = "IotChargingLineTransOrder", description = "")
@AllArgsConstructor
public class IotChargingLineTransOrder extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 终端编号
     */
    @ApiModelProperty(value = "终端编号")
    @Length(max = 20, message = "终端编号长度不能超过20")
    @TableField(value = "terminal_id", condition = LIKE)
    @Excel(name = "终端编号")
    private String terminalId;
    /**
     * 商家编号
     */
    @ApiModelProperty(value = "商家编号")
    @Length(max = 20, message = "商家编号长度不能超过20")
    @TableField(value = "merchant_id", condition = LIKE)
    @Excel(name = "商家编号")
    private Long merchantId;

    /**
     * 0失效 1 支付中 2 支付成功 3 已过期
     */
    @ApiModelProperty(value = "0失效 1 支付中 2 支付成功 3 已过期")
    @TableField("status")
    @Excel(name = "0失效 1 支付中 2 支付成功 3 已过期")
    private Integer status;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "menu_type", condition = LIKE)
    @Excel(name = "")
    private String menuType;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @TableField("trans_amt")
    @Excel(name = "交易金额")
    private Long transAmt;

    @ApiModelProperty(value = "")
    @TableField("start_time")
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime startTime;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "order_id", condition = LIKE)
    @Excel(name = "")
    private String orderId;

    @ApiModelProperty(value = "")
    @TableField("pay_type")
    @Excel(name = "")
    private Integer payType;

    /**
     * 微信用户ID
     */
    @ApiModelProperty(value = "微信用户ID")
    @Length(max = 255, message = "微信用户ID长度不能超过255")
    @TableField(value = "open_id", condition = LIKE)
    @Excel(name = "微信用户ID")
    private String openId;

    /**
     * 价格ID
     */
    @ApiModelProperty(value = "价格ID")
    @TableField("menu_id")
    @Excel(name = "价格ID")
    private Long menuId;

    /**
     * 在线小时数
     */
    @ApiModelProperty(value = "在线小时数")
    @TableField("hours")
    @Excel(name = "在线小时数")
    private Integer hours;

    /**
     * 微信订单号
     */
    @ApiModelProperty(value = "微信订单号")
    @Length(max = 255, message = "微信订单号长度不能超过255")
    @TableField(value = "wx_order_id", condition = LIKE)
    @Excel(name = "微信订单号")
    private String wxOrderId;
    @TableField(exist = false)
    private SplitTransRecord splitTransRecord;

    @Builder
    public IotChargingLineTransOrder(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long updateUser, Long createUser, 
                    String terminalId, Integer status, String menuType, Long transAmt, LocalDateTime startTime, 
                    String orderId, Integer payType, String openId, Long menuId, Integer hours, String wxOrderId) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createUser = createUser;
        this.terminalId = terminalId;
        this.status = status;
        this.menuType = menuType;
        this.transAmt = transAmt;
        this.startTime = startTime;
        this.orderId = orderId;
        this.payType = payType;
        this.openId = openId;
        this.menuId = menuId;
        this.hours = hours;
        this.wxOrderId = wxOrderId;
    }

}
